﻿using System;

using System.Windows.Forms;

namespace CodePlex.SqlGenerator
{
    /// <summary>
    /// Specifies the contextual information about an application thread.
    /// </summary>
    internal sealed class SqlGeneratorContext : ApplicationContext
    {
        #region SqlGeneratorContext Private Fields

        /// <summary>
        /// The <see cref="T:SqlGenerator"/> main form of the application.
        /// </summary>
        private static SqlGeneratorForm s_mainForm;

        #endregion

        #region public SqlGeneratorContext()

        /// <summary>
        /// Initializes a new instance of the <see cref="T:SqlGeneratorContext"/> class. 
        /// </summary>
        public SqlGeneratorContext()
        {
        }

        #endregion

        #region public SqlGeneratorContext(Form mainForm) : base(mainForm)

        /// <summary>
        /// Initializes a new instance of the <see cref="T:SqlGeneratorContext"/> class with the specified <see cref="T:System.Windows.Forms.Form"/>.
        /// </summary>
        /// <param name="mainForm">The main <see cref="T:SqlGenerator"/> of the application to use for context.</param> 
        public SqlGeneratorContext(SqlGeneratorForm mainForm) : base(mainForm)
        {
            s_mainForm = mainForm;
        }

        #endregion

        #region internal static SqlGenerator SqlGenerator

        /// <summary>
        /// Gets the <see cref="T:SqlGenerator"/> main form of the application.
        /// </summary>
        /// <value>The <see cref="T:SqlGenerator"/> main form of the application.</value>
        internal static SqlGeneratorForm SqlGenerator
        {
            get
            {
                return s_mainForm;
            }
        }

        #endregion
    }
}
